if (fexist(fconcat(httrack.path_log,"hts-in_progress.lock"))) {
/* Old cache */
if ( (fexist(fconcat(httrack.path_log,"hts-cache/old.dat"))) && (fexist(fconcat(httrack.path_log,"hts-cache/old.ndx"))) ) {
if (httrack.log != NULL) {
fprintf(httrack.log,"Warning!\n");
fprintf(httrack.log,"An aborted mirror has been detected!\nThe current temporary cache is required for any update operation and only contains data downloaded during the last aborted session.\nThe former cache might contain more complete information; if you do not want to lose that information, you have to restore it and delete the current cache.\nThis can easily be done here by erasing the hts-cache/new.* files\n");
fprintf(httrack.log,"Please restart HTTrack with --continue (-iC1) option to override this message!\n");
}
exit(0);
}
}
}
// remplacer "macros" comme --spider
// permet de lancer httrack sans a avoir α se rappeler de syntaxes comme p0C0I0Qc32 ..
#if DEBUG_STEPS
printf("Checking last macros\n");
#endif
{
int i;
for(i=0;i<argc;i++) {
#if DEBUG_STEPS
printf("Checking #%d:\n",argv[i]);
printf("%s\n",argv[i]);
#endif
if (argv[i][0]=='-') {
if (argv[i][1]=='-') { // --xxx
if ((strfield2(argv[i]+2,"clean")) || (strfield2(argv[i]+2,"tide"))) { // nettoyer
strcpybuff(argv[i]+1,"");
if (fexist(fconcat(httrack.path_log,"hts-log.txt")))
remove(fconcat(httrack.path_log,"hts-log.txt"));
if (fexist(fconcat(httrack.path_log,"hts-err.txt")))
remove(fconcat(httrack.path_log,"hts-err.txt"));
if (fexist(fconcat(httrack.path_html,"index.html")))
remove(fconcat(httrack.path_html,"index.html"));
/* */
if (fexist(fconcat(httrack.path_log,"hts-cache/new.zip")))
httrack.quiet=1; // ne pas poser de questions! (nohup par exemple)
if ((strchr(argv[na],'i')!=NULL)) { // doit.log!
argv_url=0;
na=argc;
}
}
}
}
*/
// Ici on ajoute les arguments qui ont ΘtΘ appelΘs avant au cas o∙ on rΘcupΦre une session
// Exemple: httrack www.truc.fr -L0 puis ^C puis httrack sans URL : ajouter URL prΘcΘdente
/*
if (argv_url==0) {
//if ((fexist(fconcat(httrack.path_log,"hts-cache/new.dat"))) && (fexist(fconcat(httrack.path_log,"hts-cache/new.ndx")))) { // il existe dΘja un cache prΘcΘdent.. renommer
if (fexist(fconcat(httrack.path_log,"hts-cache/doit.log"))) { // un cache est prΘsent
sprintf(tmp, "option %%W : unable to (re)plug the function %s from the file %s for the callback %s", posf, filename, callbackname);
HTS_PANIC_PRINTF(tmp);
htsmain_free();
return -1;
}
} else {
char BIGSTK tmp[1024 * 2];
sprintf(tmp, "option %%W : unable to plug the function %s from the file %s for the callback %s", posf, filename, callbackname);
HTS_PANIC_PRINTF(tmp);
htsmain_free();
return -1;
}
} else {
char BIGSTK tmp[1024 * 2];
sprintf(tmp, "option %%W : unknown or undefined callback %s", callbackname);
HTS_PANIC_PRINTF(tmp);
htsmain_free();
return -1;
}
} else {
char BIGSTK tmp[1024 * 2];
sprintf(tmp, "option %%W : unable to load the function %s in the file %s for the callback %s", posf, filename, callbackname);
HTS_PANIC_PRINTF(tmp);
htsmain_free();
return -1;
}
} else {
HTS_PANIC_PRINTF("Syntax error in option %W : filename error : this function needs to be followed by a blank space, and a <callback-name>=<myfile.so>:<function-name> field");
HTS_PANIC_PRINTF("Syntax error in option %W : this function needs to be followed by a blank space, and a <callback-name>=<myfile.so>:<function-name> field");
fprintf(fp,"Mirror in progress since %s .. please wait!"LF,t);
for(i=0;i<argc;i++) {
if (strchr(argv[i],' ')==NULL)
fprintf(fp,"%s ",argv[i]);
else // entre ""
fprintf(fp,"\"%s\" ",argv[i]);
}
fprintf(fp,LF);
fprintf(fp, "To pause the engine: create an empty file named 'hts-stop.lock'"LF);
#if USE_BEGINTHREAD
fprintf(fp, "PID=%d\n", (int)getpid());
#ifndef _WIN32
fprintf(fp, "UID=%d\n", (int)getuid());
fprintf(fp, "GID=%d\n", (int)getuid());
#endif
fprintf(fp, "START=%d\n", (int)time(NULL));
#endif
fclose(fp); fp=NULL;
}
// fichier log
if (httrack.log) {
int i;
fprintf(httrack.log,"HTTrack"HTTRACK_VERSION"%s launched on %s at %s"LF,
WHAT_is_available,
t, url);
fprintf(httrack.log,"(");
for(i=0;i<argc;i++) {
if ((strchr(argv[i],' ')==NULL) || (strchr(argv[i],'\"')))
fprintf(httrack.log,"%s ",argv[i]);
else // entre "" (si espace(s) et pas dΘja de ")
fprintf(httrack.log,"\"%s\" ",argv[i]);
}
fprintf(httrack.log,")"LF);
fprintf(httrack.log,LF);
fprintf(httrack.log,"Information, Warnings and Errors reported for this mirror:"LF);
fprintf(httrack.log,HTS_LOG_SECURITY_WARNING );
fprintf(httrack.log,LF);
}
if (httrack_logmode) {
printf("Mirror launched on %s by HTTrack Website Copier/"HTTRACK_VERSION"%s "HTTRACK_AFF_AUTHORS""LF,t,WHAT_is_available);
if (httrack.wizard==0) {
printf("mirroring %s with %d levels, %d sockets,t=%d,s=%d,logm=%d,lnk=%d,mdg=%d\n",url,httrack.depth,httrack.maxsoc,httrack.travel,httrack.seeker,httrack_logmode,httrack.urlmode,httrack.getmode);
} else { // the magic wizard
printf("mirroring %s with the wizard help..\n",url);
}
}
}
io_flush;
/* Enforce limits to avoid bandwith abuse. The bypass_limits should only be used by administrators and experts. */
if (!httrack.bypass_limits) {
if (httrack.maxsoc <= 0 || httrack.maxsoc > 4) {
httrack.maxsoc = 4;
if (httrack.log != NULL) {
fspc(httrack.log,"warning"); fprintf(httrack.log,"* security warning: maximum number of simultaneous connections limited to %d to avoid server overload"LF, (int)httrack.maxsoc);
}
}
if (httrack.maxrate <= 0 || httrack.maxrate > 100000) {
httrack.maxrate = 100000;
if (httrack.log != NULL) {
fspc(httrack.log,"warning"); fprintf(httrack.log,"* security warning: maximum bandwidth limited to %d to avoid server overload"LF, (int)httrack.maxrate);
}
}
if (httrack.maxconn <= 0 || httrack.maxconn > 5.0) {
httrack.maxconn = 5.0;
if (httrack.log != NULL) {
fspc(httrack.log,"warning"); fprintf(httrack.log,"* security warning: maximum number of connections per second limited to %f to avoid server overload"LF, (float)httrack.maxconn);
}
}
} else {
if (httrack.log != NULL) {
fspc(httrack.log,"warning"); fprintf(httrack.log,"* security warning: !!! BYPASSING SECURITY LIMITS - MONITOR THIS SESSION WITH EXTREME CARE !!!"LF);
fspc(httrack.log,"info"); fprintf(httrack.log,"Top index rebuilt (done)"LF);
}
}
}
if (exit_xh ==1) {
if (httrack.log) {
fprintf(httrack.log,"* * MIRROR ABORTED! * *\nThe current temporary cache is required for any update operation and only contains data downloaded during the present aborted session.\nThe former cache might contain more complete information; if you do not want to lose that information, you have to restore it and delete the current cache.\nThis can easily be done here by erasing the hts-cache/new.* files]\n");